package br.com.moxeon.control;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import br.com.moxeon.model.IPersistentEntity;
import br.com.moxeon.model.financialitems.ThirdCheck;
import br.com.vexillum.util.Return;

@Service
@Scope("prototype")
public class ThirdCheckController extends CheckController<ThirdCheck>{

	public ThirdCheckController() {
		super(ThirdCheck.class);
	}
	
	@Override
	public Return listAll() {
		String sql = "FROM " + classEntity.getSimpleName() + " WHERE active = true";
		if(data.get("entity") == null || (((IPersistentEntity) data.get("entity")).getActive() == null) || !((IPersistentEntity) data.get("entity")).getActive()){
			sql = sql.replace(" WHERE active = true", "");
		}
		data.put("sql", sql);
		return super.searchByHQL();
	}
}
